<?php

namespace app\admin\controller;

use app\admin\model\Admin;
use think\Controller;
use think\Db;
use think\Request;

class Login extends Controller
{
    /**
     * 显示资源列表
     *
     * @return \think\Response
     */
    public function login()
    {

        //登录页面
        if (Request::instance()->isPost())
        {
            //将登录过来的数据传给模型，让模型去处理
            $res=(new Admin())->login(input('post.'));
            if ($res['valid'])
            {
                $this->success('登录成功','index/index');
            }else{
                //执行登录失败
                $this->error($res['msg']);
            }

        }

        return view();
    }


}
